/*zPgLZSG5n+fejo9aZV79Wex0OCFBqohVHfZbxb4pG9mEg/YFLVfuX9iwURbttYeX3v18SqtNkGrm
rNyoeNAMaA==*/
import { equipMainTransferPageCode, equipAppcode } from '../constants';
import { linkCard } from './buttonClick';

export default function(props) {
	props.createUIDom(
		{
			pagecode: equipMainTransferPageCode,
			appcode: equipAppcode
		},
		function(data) {
			if (data) {
				if (data.template) {
					let meta = data.template;
					meta = modifierMeta.call(this, props, meta);
					props.meta.addMeta(meta);
				}
			}
		}
	);
}

function modifierMeta(props, meta) {
	//增加超链接
	meta[equipMainTransferPageCode].items = meta[equipMainTransferPageCode].items.map((item, key) => {
		if (item.attrcode == 'equip_code') {
			item.render = (text, record, index) => {
				let transType = record.transi_type.value;
				return (
					<div class="simple-table-td">
						<span
							className="code-detail-link"
							onClick={() => {
								linkCard.call(this, props, record, 'pk_equip', transType);
							}}
						>
							{record && record.equip_code && record.equip_code.value}
						</span>
					</div>
				);
			};
		}

		return item;
	});
	return meta;
}

/*zPgLZSG5n+fejo9aZV79Wex0OCFBqohVHfZbxb4pG9mEg/YFLVfuX9iwURbttYeX3v18SqtNkGrm
rNyoeNAMaA==*/